package org.domain.demo.session.query;

import org.domain.demo.entity.Books;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("bookQuery")
public class BookQuery extends EntityQuery<Books>
{

    private static final String EJBQL = "select books from Books books";

    private static final String[] RESTRICTIONS = {
        "lower(books.bookName) like lower(concat(#{bookQuery.books.bookName},'%'))",
    };

    private Books books = new Books();

    public BookQuery()
    {
        setEjbql(EJBQL);
        setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
    }

    public Books getBooks()
    {
        return books;
    }
}
